package com.ruksis.motogeek;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class MotoDB extends SQLiteOpenHelper {
	
	private final static String _dbName = "motodb";
	private final static int _dbVer = 1;
	
	public MotoDB(Context context) {
		super(context, _dbName, null, _dbVer);
	}

	public void startNewSession() {
		
	}
	
	public void stopCurrentSession() {
		
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL("create table sessions(id integer primary key, startTime integer, endTime integer);");
		db.execSQL("create table data(id integer primary key,sess_id integer, timestamp integer, type integer, value float);");
		db.execSQL("create index data_ind1 on data(sess_id,timestamp,type);");
		db.execSQL("create index data_ind2 on data(sess_id,type,timestamp);");
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub
		
	}
	
}
